﻿using System;
using System.Collections.Generic;
using FrameCase.Infrastructure;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Model.BusinessLogic.PhysicalData;
using Model.Manager;
using System.Linq;
using Model.Manager.DataBase;
using BML;
using BML.Infrastructure;
using Model.Platform.PhysicalData;

namespace FrameCase
{
    [TestClass]
    public class OpCase:BaseCase
    {

        /// <summary>
        ///     新Linq查询写法
        /// </summary>
        [TestMethod]
        public void Linq()
        {
            using (IDbContext context = ContextFactory.GetBlConn())
            {
                //Obsolete : context.GetOperator<Tag>().CreateQuery().ToList();
                var list = context.Queryable<Tag>().ToList().Select(m=>m.Name);
                ConsoleList(list);
            }
        }

        /// <summary>
        ///     
        /// </summary>
        [TestMethod]
        public void DataBaseContext()
        {
            using (IDbContext db = ContextFactory.GetPlatformConnect())
            {
                 new Dictionary<Int32, Int32>
                {
                    {
                        1000,
                        db.Queryable<ExceptionLog>()
                            .Count(m => m.Status == OpertorStatusCode.New || m.Status == OpertorStatusCode.Display)
                    },
                    {
                        2000,
                        db.Queryable<UserVisitLog>()
                            .Count(m => m.Status == OpertorStatusCode.New || m.Status == OpertorStatusCode.Display)
                    },
                };
            }
        }





    }
}
